<?php
/**
  * Musashi - A project manager for music groups and bands
  * Copyright (C) 2010 Daniel Torres
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation, either version 3 of the License, or
  * (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  *
  */

/**
 *  Default page for starting or managing shows.
 *  This same page starts or edits a show, depending on whether a show id (sid)
 *  has been provided, or not. In all cases, it is assumed that the viewer
 *  has modification permisions for the show. Otherwise, default_member should
 *  be used instead.
 *  
 * @package com_musashi
 * @author Daniel Torres
 */
 
// Make sure we have access to this page
defined('_JEXEC') or die ('Restricted access. Sorry');
 
// Add the stylesheet for this page
JHTML::_('stylesheet','base.css','components/com_musashi/views/common/');
JHTML::_('script','dragdrop.js','components/com_musashi/views/common/');
JHTML::_('script','jquery-1.5.min.js','components/com_musashi/views/common/');
JHTML::_('stylesheet','default.css','components/com_musashi/views/shows/tmpl/');

// Get the show id, if any
$showID = JRequest::getInt('sid',-1);

// We'll be needing this model
$model =& $this->getModel();


/**
 *  Checks to see if there is a message from a previous action. Clears the flag if necessary
 */
function getActionResult( $actionFlag )
{
    $session =& JFactory::getSession();
    
    // Get previous message, then clear
    $msg = $session->get($actionFlag,'');
    $session->set($actionFlag,'');
    
    return $msg;
}

// Get some required information
$showData  = $model->getShowData($showID);
$creator   = $model->getShowCreator($showID);
    

?>
<script language="javascript" type="text/javascript">
<!--

    // Compatibility mode for jQuery
    var _jq = jQuery.noConflict();
        
    // Animation duration
    var GUI_FADE_SPEED = 400;

-->
</script>
<!--[if IE]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->


<musashiContent id='content' class='body'>
    
    <header id="title" class="body">
        <div class="name">
            <h1><?php if($showID == -1) { echo 'Start a show'; } else { echo 'Configuring your show'; }?></h1>
        </div>
        <div class="description">
        <p>This page allows you to configure your show. Add as much information
        as you have available. You can always come back and modify it. As the
        owner, you have more editing rights that other members.</p>
        </div>
    </header>
    
    <?php
    
    // -------------------------------------------------------------------------
    // Previous action result
    // -------------------------------------------------------------------------
    $previousMessage = getActionResult('errorMessage');
    if( $previousMessage != '')
    {?>
        <div class="error"><?php echo $previousMessage; ?></div>
    <?php        
    }    
                
    ?>
        
        <!-- The gist of it -->
        <div id='show-header'>
            <div class='show-header-title'>
                <h1><?php echo $showData['name'];  ?></h1>
                <h2>Created by <?php echo $creator; ?></h2>
            </div>
            <div class='show-header-date'>
                <h2 style='margin:10px 0 0 0;'><?php echo date("l F jS\, Y",$phpdate);?></h2>
                <h2 style='margin:5px 0 0 0;'><?php echo date("g:i a",$phpdate);?></h2>
            </div>
        </div>
                                
        <!-- --------------------------------------------------------------- -->
        <!-- Basic show information -->
        <!-- --------------------------------------------------------------- -->
        
        <?php
        include '_section_basicInfo.php';
        displayBasicInformation(false, $showID, $model, $showData );
        ?>
        
        <!-- --------------------------------------------------------------- -->
        <!-- Venue -->
        <!-- --------------------------------------------------------------- -->
        <?php
        include '_section_venue.php';
        displayVenue(false, $showID, $model, $showData );
        ?>
                
        <!-- --------------------------------------------------------------- -->
        <!-- Members -->
        <!-- --------------------------------------------------------------- -->
        <?php
        include '_section_members.php';
        displayMembers(false, $showID, $model, $showData );
        ?>        

        <!-- Show design -->
        <a name="design" style="text-decoration:none;">
        <section id='show-data'>
            <div id='section-title'>
                <h1>Show Design</h1>
            </div>
            
        </section>
        </a>
        
        <!-- Clothing and costumes -->
        <a name="clothes" style="text-decoration:none;">
        <section id='show-data'>
            <div id='section-title'>
                <h1>Clothing and Costumes</h1>
            </div>
            
        </section>
        </a>
        
        <!-- Equipment -->
        <a name="equipment" style="text-decoration:none;">
        <section id='show-data'>
            <div id='section-title'>
                <h1>Equipment</h1>
            </div>
            
        </section>
        </a>
        
    
    <!-- Footer. Display syndication, and some copyright information -->
    <footer id="footer" class="body">
        <div class="footer-data">
            <h2>The Musashi Project</h2>
            <h3>A Framework for Managing Your Group</h3>
            <p>(c)2010 - The Musashi Project</p>                    
        </div>
    </footer>
    
    
</musashiContent>










